<template>
	<view class="container">
		<view class="item" :style="{ backgroundImage: (item.type==='0'?'url(' + grBg + ')':'url(' + dwBg + ')') }" v-for="(item,index) in list" :key="index">
			<view class="text">发票抬头&#12288;{{item.title}}</view>
			<view class="text">发票金额&#12288;￥{{item.money}}</view>
			<view class="text">发票内容&#12288;服务费</view>
		</view>
		<u-loadmore class="u-m-t-40" :status="loadStatus" bgColor="#f4f4f4"></u-loadmore>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dwBg: this.$mAssetsPath.dwBg,
				grBg: this.$mAssetsPath.grBg,
				form: {
					pageNum: 1,
					pageSize: 10,
				},
				loadStatus: 'loadmore',
				list:[]
			}
		},
		onLoad() {
			this.getList();
		},
		onPullDownRefresh: function() {
			this.form.pageNum = 1;
			this.getList();
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom:function(e){
			// 此tab为空数据
			this.form.pageNum += 1;
			this.loadStatus= "loading";
			this.getList(this.form.pageNum);
			setTimeout(() => {
				this.loadStatus="loadmore";
			}, 1000);
		},
		methods: {
			async getList(page){
				let data = await this.$apis.findInvoiceAll(this.form);
				if (data.data.last) {
					this.loadStatus = "nomore";
				}
				if (page) {
					this.list = this.list.concat(data.data.content);
				} else {
					this.list = data.data.content;
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	page{
		background-color: #f4f4f4;
	}
	.container{
		display: flex;
		flex-direction: column;
		padding: 27upx 30upx;
		.item{
			background-size: 100% auto;
			width: 690upx;
			height: 253upx;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			padding: 20upx 40upx 60upx 40upx;
			margin-bottom: 30upx;
			.text{
				color: #fff;
				font-size: 28upx;
			}
		}
		.dw{
		}
	}
</style>
